USE [master]
GO
/****** Object:  Database [BukstorBD]    Script Date: 09/17/2012 14:10:06 ******/
CREATE DATABASE [BukstorBD] ON  PRIMARY 
( NAME = N'BDBukstor', FILENAME = N'c:\DATA\BDBukstor.mdf' , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'BDBukstor_log', FILENAME = N'c:\DATA\BDBukstor_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
ALTER DATABASE [BukstorBD] SET COMPATIBILITY_LEVEL = 100
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [BukstorBD].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [BukstorBD] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [BukstorBD] SET ANSI_NULLS OFF
GO
ALTER DATABASE [BukstorBD] SET ANSI_PADDING OFF
GO
ALTER DATABASE [BukstorBD] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [BukstorBD] SET ARITHABORT OFF
GO
ALTER DATABASE [BukstorBD] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [BukstorBD] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [BukstorBD] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [BukstorBD] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [BukstorBD] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [BukstorBD] SET CURSOR_DEFAULT  GLOBAL
GO
ALTER DATABASE [BukstorBD] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [BukstorBD] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [BukstorBD] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [BukstorBD] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [BukstorBD] SET  DISABLE_BROKER
GO
ALTER DATABASE [BukstorBD] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [BukstorBD] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [BukstorBD] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [BukstorBD] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [BukstorBD] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [BukstorBD] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [BukstorBD] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [BukstorBD] SET  READ_WRITE
GO
ALTER DATABASE [BukstorBD] SET RECOVERY SIMPLE
GO
ALTER DATABASE [BukstorBD] SET  MULTI_USER
GO
ALTER DATABASE [BukstorBD] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [BukstorBD] SET DB_CHAINING OFF
GO
USE [BukstorBD]
GO
/****** Object:  Table [dbo].[Clientes]    Script Date: 09/17/2012 14:10:08 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Clientes](
	[idCliente] [int] IDENTITY(1,1) NOT NULL,
	[username] [nvarchar](50) NOT NULL,
	[password] [nchar](10) NOT NULL,
	[apellido] [nvarchar](50) NOT NULL,
	[nombre] [nvarchar](50) NOT NULL,
	[e-mail] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_Clientes] PRIMARY KEY CLUSTERED 
(
	[idCliente] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Categorias]    Script Date: 09/17/2012 14:10:08 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Categorias](
	[idCategoria] [int] IDENTITY(1,1) NOT NULL,
	[nombre] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_Categorias] PRIMARY KEY CLUSTERED 
(
	[idCategoria] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EstadosDelPedido]    Script Date: 09/17/2012 14:10:08 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EstadosDelPedido](
	[idEstado] [int] IDENTITY(1,1) NOT NULL,
	[nombre] [nchar](10) NOT NULL,
 CONSTRAINT [PK_EstadosDelPedido] PRIMARY KEY CLUSTERED 
(
	[idEstado] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Empleados]    Script Date: 09/17/2012 14:10:08 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Empleados](
	[idEmpleado] [int] IDENTITY(1,1) NOT NULL,
	[username] [nvarchar](50) NOT NULL,
	[password] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_Empleados] PRIMARY KEY CLUSTERED 
(
	[idEmpleado] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Editoriales]    Script Date: 09/17/2012 14:10:08 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Editoriales](
	[idEditorial] [int] IDENTITY(1,1) NOT NULL,
	[nombre] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_Editoriales] PRIMARY KEY CLUSTERED 
(
	[idEditorial] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Provincias]    Script Date: 09/17/2012 14:10:08 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Provincias](
	[idProvincia] [int] IDENTITY(1,1) NOT NULL,
	[nombre] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_Provincias] PRIMARY KEY CLUSTERED 
(
	[idProvincia] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Autores]    Script Date: 09/17/2012 14:10:08 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Autores](
	[idAutor] [int] IDENTITY(1,1) NOT NULL,
	[nombre] [nvarchar](50) NULL,
	[apellido] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_Autores] PRIMARY KEY CLUSTERED 
(
	[idAutor] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Subcategorias]    Script Date: 09/17/2012 14:10:08 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Subcategorias](
	[idSubategoria] [int] IDENTITY(1,1) NOT NULL,
	[nombre] [nvarchar](50) NOT NULL,
	[idCategoria] [int] NOT NULL,
 CONSTRAINT [PK_Subcategorias] PRIMARY KEY CLUSTERED 
(
	[idSubategoria] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Direcciones]    Script Date: 09/17/2012 14:10:08 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Direcciones](
	[idDireccion] [int] IDENTITY(1,1) NOT NULL,
	[calle] [nvarchar](50) NOT NULL,
	[numero] [int] NOT NULL,
	[piso] [int] NULL,
	[departamento] [char](2) NULL,
	[localidad] [nvarchar](50) NULL,
	[codigoPostal] [char](8) NOT NULL,
	[idProvincia] [int] NOT NULL,
	[idCliente] [int] NOT NULL,
 CONSTRAINT [PK_Direcciones] PRIMARY KEY CLUSTERED 
(
	[idDireccion] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CostosPorProvincia]    Script Date: 09/17/2012 14:10:08 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CostosPorProvincia](
	[idProvincia] [int] IDENTITY(1,1) NOT NULL,
	[costoPorPedido] [money] NOT NULL,
	[costoPorArticulo] [money] NOT NULL,
	[plazo] [tinyint] NOT NULL,
 CONSTRAINT [PK_CostosPorProvincia_1] PRIMARY KEY CLUSTERED 
(
	[idProvincia] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Libros]    Script Date: 09/17/2012 14:10:08 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Libros](
	[idLibro] [int] IDENTITY(1,1) NOT NULL,
	[isbn] [char](13) NOT NULL,
	[titulo] [nvarchar](50) NOT NULL,
	[idEditorial] [int] NOT NULL,
	[tapa] [image] NULL,
	[sinopsis] [nvarchar](max) NOT NULL,
	[idSubcategoria] [int] NOT NULL,
	[discontinuo] [bit] NOT NULL,
 CONSTRAINT [PK_Libros] PRIMARY KEY CLUSTERED 
(
	[idLibro] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Pedidos]    Script Date: 09/17/2012 14:10:08 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Pedidos](
	[idPedido] [int] IDENTITY(1,1) NOT NULL,
	[idCliente] [int] NOT NULL,
	[importe] [float] NOT NULL,
	[fecha] [date] NOT NULL,
	[entregaEstimada] [date] NULL,
	[idDireccionDestino] [int] NOT NULL,
	[idEstado] [int] NOT NULL,
	[codigoRastreo] [varchar](50) NULL,
 CONSTRAINT [PK_Pedidos] PRIMARY KEY CLUSTERED 
(
	[idPedido] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Reservas]    Script Date: 09/17/2012 14:10:08 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Reservas](
	[idReserva] [int] IDENTITY(1,1) NOT NULL,
	[idCliente] [int] NOT NULL,
	[idLibro] [int] NOT NULL,
	[fecha] [date] NOT NULL,
	[ingresoInventario] [bit] NOT NULL,
 CONSTRAINT [PK_Reservas] PRIMARY KEY CLUSTERED 
(
	[idReserva] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LibrosPedidos]    Script Date: 09/17/2012 14:10:08 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LibrosPedidos](
	[idPedido] [int] NOT NULL,
	[idLibro] [int] NOT NULL,
	[cantidad] [int] NOT NULL,
 CONSTRAINT [PK_LibrosPedidos] PRIMARY KEY CLUSTERED 
(
	[idPedido] ASC,
	[idLibro] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Inventario]    Script Date: 09/17/2012 14:10:08 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Inventario](
	[idLibro] [int] NOT NULL,
	[cantidad] [int] NOT NULL,
	[stockMaximo] [int] NOT NULL,
	[stockMinimo] [int] NOT NULL,
	[precioUnitario] [money] NOT NULL,
 CONSTRAINT [PK_Inventario] PRIMARY KEY CLUSTERED 
(
	[idLibro] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AutoresLibros]    Script Date: 09/17/2012 14:10:08 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AutoresLibros](
	[idAutor] [int] NOT NULL,
	[idLibro] [int] NOT NULL,
 CONSTRAINT [PK_AutoresLibros] PRIMARY KEY CLUSTERED 
(
	[idAutor] ASC,
	[idLibro] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Default [DF_Libros_discontinuo]    Script Date: 09/17/2012 14:10:08 ******/
ALTER TABLE [dbo].[Libros] ADD  CONSTRAINT [DF_Libros_discontinuo]  DEFAULT ((0)) FOR [discontinuo]
GO
/****** Object:  Default [DF_Reservas_fecha]    Script Date: 09/17/2012 14:10:08 ******/
ALTER TABLE [dbo].[Reservas] ADD  CONSTRAINT [DF_Reservas_fecha]  DEFAULT (getdate()) FOR [fecha]
GO
/****** Object:  Default [DF_Reservas_ingresoInventario]    Script Date: 09/17/2012 14:10:08 ******/
ALTER TABLE [dbo].[Reservas] ADD  CONSTRAINT [DF_Reservas_ingresoInventario]  DEFAULT ((0)) FOR [ingresoInventario]
GO
/****** Object:  Default [DF_LibrosPedidos_cantidad]    Script Date: 09/17/2012 14:10:08 ******/
ALTER TABLE [dbo].[LibrosPedidos] ADD  CONSTRAINT [DF_LibrosPedidos_cantidad]  DEFAULT ((1)) FOR [cantidad]
GO
/****** Object:  ForeignKey [FK_Subcategorias_Categorias]    Script Date: 09/17/2012 14:10:08 ******/
ALTER TABLE [dbo].[Subcategorias]  WITH CHECK ADD  CONSTRAINT [FK_Subcategorias_Categorias] FOREIGN KEY([idCategoria])
REFERENCES [dbo].[Categorias] ([idCategoria])
GO
ALTER TABLE [dbo].[Subcategorias] CHECK CONSTRAINT [FK_Subcategorias_Categorias]
GO
/****** Object:  ForeignKey [FK_Direcciones_Clientes]    Script Date: 09/17/2012 14:10:08 ******/
ALTER TABLE [dbo].[Direcciones]  WITH CHECK ADD  CONSTRAINT [FK_Direcciones_Clientes] FOREIGN KEY([idCliente])
REFERENCES [dbo].[Clientes] ([idCliente])
GO
ALTER TABLE [dbo].[Direcciones] CHECK CONSTRAINT [FK_Direcciones_Clientes]
GO
/****** Object:  ForeignKey [FK_Direcciones_Provincias]    Script Date: 09/17/2012 14:10:08 ******/
ALTER TABLE [dbo].[Direcciones]  WITH CHECK ADD  CONSTRAINT [FK_Direcciones_Provincias] FOREIGN KEY([idProvincia])
REFERENCES [dbo].[Provincias] ([idProvincia])
GO
ALTER TABLE [dbo].[Direcciones] CHECK CONSTRAINT [FK_Direcciones_Provincias]
GO
/****** Object:  ForeignKey [FK_CostosPorProvincia_Provincias]    Script Date: 09/17/2012 14:10:08 ******/
ALTER TABLE [dbo].[CostosPorProvincia]  WITH CHECK ADD  CONSTRAINT [FK_CostosPorProvincia_Provincias] FOREIGN KEY([idProvincia])
REFERENCES [dbo].[Provincias] ([idProvincia])
GO
ALTER TABLE [dbo].[CostosPorProvincia] CHECK CONSTRAINT [FK_CostosPorProvincia_Provincias]
GO
/****** Object:  ForeignKey [FK_Libros_Editoriales]    Script Date: 09/17/2012 14:10:08 ******/
ALTER TABLE [dbo].[Libros]  WITH CHECK ADD  CONSTRAINT [FK_Libros_Editoriales] FOREIGN KEY([idEditorial])
REFERENCES [dbo].[Editoriales] ([idEditorial])
GO
ALTER TABLE [dbo].[Libros] CHECK CONSTRAINT [FK_Libros_Editoriales]
GO
/****** Object:  ForeignKey [FK_Libros_Subcategorias]    Script Date: 09/17/2012 14:10:08 ******/
ALTER TABLE [dbo].[Libros]  WITH CHECK ADD  CONSTRAINT [FK_Libros_Subcategorias] FOREIGN KEY([idSubcategoria])
REFERENCES [dbo].[Subcategorias] ([idSubategoria])
GO
ALTER TABLE [dbo].[Libros] CHECK CONSTRAINT [FK_Libros_Subcategorias]
GO
/****** Object:  ForeignKey [FK_Pedidos_Clientes]    Script Date: 09/17/2012 14:10:08 ******/
ALTER TABLE [dbo].[Pedidos]  WITH CHECK ADD  CONSTRAINT [FK_Pedidos_Clientes] FOREIGN KEY([idCliente])
REFERENCES [dbo].[Clientes] ([idCliente])
GO
ALTER TABLE [dbo].[Pedidos] CHECK CONSTRAINT [FK_Pedidos_Clientes]
GO
/****** Object:  ForeignKey [FK_Pedidos_Direcciones]    Script Date: 09/17/2012 14:10:08 ******/
ALTER TABLE [dbo].[Pedidos]  WITH CHECK ADD  CONSTRAINT [FK_Pedidos_Direcciones] FOREIGN KEY([idDireccionDestino])
REFERENCES [dbo].[Direcciones] ([idDireccion])
GO
ALTER TABLE [dbo].[Pedidos] CHECK CONSTRAINT [FK_Pedidos_Direcciones]
GO
/****** Object:  ForeignKey [FK_Pedidos_EstadosDelPedido]    Script Date: 09/17/2012 14:10:08 ******/
ALTER TABLE [dbo].[Pedidos]  WITH CHECK ADD  CONSTRAINT [FK_Pedidos_EstadosDelPedido] FOREIGN KEY([idEstado])
REFERENCES [dbo].[EstadosDelPedido] ([idEstado])
GO
ALTER TABLE [dbo].[Pedidos] CHECK CONSTRAINT [FK_Pedidos_EstadosDelPedido]
GO
/****** Object:  ForeignKey [FK_Reservas_Clientes]    Script Date: 09/17/2012 14:10:08 ******/
ALTER TABLE [dbo].[Reservas]  WITH CHECK ADD  CONSTRAINT [FK_Reservas_Clientes] FOREIGN KEY([idCliente])
REFERENCES [dbo].[Clientes] ([idCliente])
GO
ALTER TABLE [dbo].[Reservas] CHECK CONSTRAINT [FK_Reservas_Clientes]
GO
/****** Object:  ForeignKey [FK_Reservas_Libros]    Script Date: 09/17/2012 14:10:08 ******/
ALTER TABLE [dbo].[Reservas]  WITH CHECK ADD  CONSTRAINT [FK_Reservas_Libros] FOREIGN KEY([idLibro])
REFERENCES [dbo].[Libros] ([idLibro])
GO
ALTER TABLE [dbo].[Reservas] CHECK CONSTRAINT [FK_Reservas_Libros]
GO
/****** Object:  ForeignKey [FK_LibrosPedidos_Libros]    Script Date: 09/17/2012 14:10:08 ******/
ALTER TABLE [dbo].[LibrosPedidos]  WITH CHECK ADD  CONSTRAINT [FK_LibrosPedidos_Libros] FOREIGN KEY([idLibro])
REFERENCES [dbo].[Libros] ([idLibro])
GO
ALTER TABLE [dbo].[LibrosPedidos] CHECK CONSTRAINT [FK_LibrosPedidos_Libros]
GO
/****** Object:  ForeignKey [FK_LibrosPedidos_Pedidos]    Script Date: 09/17/2012 14:10:08 ******/
ALTER TABLE [dbo].[LibrosPedidos]  WITH CHECK ADD  CONSTRAINT [FK_LibrosPedidos_Pedidos] FOREIGN KEY([idPedido])
REFERENCES [dbo].[Pedidos] ([idPedido])
GO
ALTER TABLE [dbo].[LibrosPedidos] CHECK CONSTRAINT [FK_LibrosPedidos_Pedidos]
GO
/****** Object:  ForeignKey [FK_Inventario_Libros]    Script Date: 09/17/2012 14:10:08 ******/
ALTER TABLE [dbo].[Inventario]  WITH CHECK ADD  CONSTRAINT [FK_Inventario_Libros] FOREIGN KEY([idLibro])
REFERENCES [dbo].[Libros] ([idLibro])
GO
ALTER TABLE [dbo].[Inventario] CHECK CONSTRAINT [FK_Inventario_Libros]
GO
/****** Object:  ForeignKey [FK_AutoresLibros_Autores]    Script Date: 09/17/2012 14:10:08 ******/
ALTER TABLE [dbo].[AutoresLibros]  WITH CHECK ADD  CONSTRAINT [FK_AutoresLibros_Autores] FOREIGN KEY([idAutor])
REFERENCES [dbo].[Autores] ([idAutor])
GO
ALTER TABLE [dbo].[AutoresLibros] CHECK CONSTRAINT [FK_AutoresLibros_Autores]
GO
/****** Object:  ForeignKey [FK_AutoresLibros_Libros]    Script Date: 09/17/2012 14:10:08 ******/
ALTER TABLE [dbo].[AutoresLibros]  WITH CHECK ADD  CONSTRAINT [FK_AutoresLibros_Libros] FOREIGN KEY([idLibro])
REFERENCES [dbo].[Libros] ([idLibro])
GO
ALTER TABLE [dbo].[AutoresLibros] CHECK CONSTRAINT [FK_AutoresLibros_Libros]
GO
